<template>
  <div class="login-container flx-center">
    <div class="login-box" v-if="isMobile">
      <SwitchDark class="dark" />
      <div class="login-left">
        <img class="login-left-img" src="@/assets/images/login_left.png" alt="login" />
      </div>
      <div class="login-form">
        <div class="login-logo">
          <!-- <img class="login-icon" src="@/assets/images/logo.svg" alt="" /> -->
          <h2 class="logo-text">{{ systematicName }}</h2>
        </div>
        <LoginForm />
      </div>
    </div>
    <div v-else class="mobile-login-box">
      <div class="login-logo">
        <!-- <img class="login-icon" src="@/assets/images/logo.svg" alt="" /> -->
        <h2 class="logo-text">移动管理系统</h2>
      </div>
      <div>
        <MobileLogin></MobileLogin>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts" name="login">
import { ref, onMounted } from "vue";
import axios from "axios";
import LoginForm from "./components/LoginForm.vue";
import MobileLogin from "@/views/mobile/login/index.vue";
import SwitchDark from "@/components/SwitchDark/index.vue";

// 系统名称
const systematicName = ref("");
// 是否是移动端
const isMobile = ref(false);
// 判断是移动端还是pc端
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
  isMobile.value = false;
} else {
  isMobile.value = true;
}
onMounted(() => {
  axios.get("/config.json").then(res => {
    systematicName.value = res.data.systematicName;
  });
});
</script>

<style scoped lang="scss">
@import "./index.scss";
</style>
